<h1><?php echo Araclar::yaz("Beceri Güncelle","Update Skill"); ?></h1>
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'mezuniyet-bilgileri-form',
	'enableAjaxValidation'=>false,
	'htmlOptions' => array(
            'enctype' => 'multipart/form-data'
     ),
)); ?>
<table width="100%">
	<tr>
		<td>
			<?php echo Araclar::yaz("Becerinin adı TR","Skill Title TR"); ?>:
		</td>
		<td>
			<?php 
				echo CHtml::textArea("beceri_adi",$model_beceriler->beceri_adi,array('cols'=>'70','rows'=>'1'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Becerinin adı EN","Skill Title EN"); ?>:
		</td>
		<td>
			<?php 
				echo CHtml::textArea("beceri_adi_en",$model_beceriler->beceri_adi_en,array('cols'=>'70','rows'=>'1'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Kategorisi","Category"); ?>:
		</td>
		<td>
			<?php 
				$model_kategori = BecerilerKategori::model()->findAll();
				echo CHtml::dropDownList("kategori_id", $model_beceriler->kategori_id, CHtml::listData($model_kategori, 'id', Araclar::yaz('kategori_adi','kategori_adi_en')))
			?>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<?php echo Araclar::yaz("Video (Tüm beceri için)","Video (including all steps)"); ?>:
		</td>
	</tr>	
	<tr>
		<td colspan="2">
			<?php
				echo "URL: ".CHtml::textArea("video_url",$model_beceriler->video_url,array('cols'=>'70', 'rows'=>'1'));
				echo "<br />";
				echo Araclar::yaz('Dosya','File').": ".CHtml::fileField("video_dosya");
				if(!empty($model_beceriler->video_url)){
					if(substr($model_beceriler->video_url,0,4)!="http"){
						echo "<br />".Araclar::yaz("Yüklü Dosya",'Uploaded File').": <a href='/cokluortam/".$model_beceriler->id."/video/".$model_beceriler->video_url."'>";
						echo $model_beceriler->video_url;
						echo "</a> ";
						echo "&nbsp;&nbsp;&nbsp;";
						echo "<a href='";
						echo Yii::app()->createUrl("yonetici/update", array(
							'id'=>$model_beceriler->id,
							'video_sil_id'=>$model_beceriler->id,
						));
						echo "'>".Araclar::yaz("Dosyayı Sil",'Delete File')."</a>";
					}
				}
			
			?>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<?php echo Araclar::yaz("Canlandırma (Tüm beceri için)","Animation (including all steps)"); ?>:
		</td>
	</tr>	
	<tr>
		<td colspan="2">
			<?php
				echo "URL: ".CHtml::textArea("anim_url",$model_beceriler->anim_url,array('cols'=>'70', 'rows'=>'1'));
				echo "<br />";
				echo Araclar::yaz("Dosya",'File').": ".CHtml::fileField("anim_dosya");
				if(!empty($model_beceriler->anim_url)){
					if(substr($model_beceriler->anim_url,0,4)!="http"){
						echo "<br />".Araclar::yaz("Yüklü Dosya",'Uploaded File').": <a href='/cokluortam/".$model_beceriler->id."/anim/".$model_beceriler->anim_url."'>";
						echo $model_beceriler->anim_url;
						echo "</a> ";
						echo "&nbsp;&nbsp;&nbsp;";
						echo "<a href='";
						echo Yii::app()->createUrl("yonetici/update", array(
							'id'=>$model_beceriler->id,
							'anim_sil_id'=>$model_beceriler->id,
						));
						echo "'>".Araclar::yaz("Dosyayı Sil",'Delete File')."</a>";
					}
				}
			
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Öğrenme Alanı","Learning Area"); ?>:
		</td>
		<td>
			<?php 
				echo CHtml::textArea("ogrenme_alani",$model_beceriler->ogrenme_alani,array('cols'=>'70','rows'=>'2'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Ön Yeterlilikler","Pre Skills"); ?>:
		</td>
		<td>
			<?php 
				echo CHtml::textArea("on_yeterlilikler",$model_beceriler->on_yeterlilikler,array('cols'=>'70','rows'=>'2'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Beceri Analizi Ekibi","Skill Analysis Stuff"); ?>:
		</td>
		<td>
			<?php 
				echo CHtml::textArea("beceri_analizi_ekibi",$model_beceriler->beceri_analizi_ekibi,array('cols'=>'70','rows'=>'2'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Video Ekibi","Video Stuff"); ?>:
		</td>
		<td>
			<?php 
				echo CHtml::textArea("video_ekibi",$model_beceriler->video_ekibi,array('cols'=>'70','rows'=>'2'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Seslendiren","Narrator"); ?>:
		</td>
		<td>
			<?php 
				echo CHtml::textArea("seslendiren",$model_beceriler->seslendiren,array('cols'=>'70','rows'=>'2'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Canlandırma Ekibi","Animation Stuff"); ?>:
		</td>
		<td>
			<?php 
				echo CHtml::textArea("anim_ekibi",$model_beceriler->anim_ekibi,array('cols'=>'70','rows'=>'2'));
			?>
		</td>
	</tr>
	
	<tr>
		<td colspan="2">
			<?php
				echo CHtml::submitButton('Kaydet');
			?>
		</td>
	</tr>	
</table>
<?php
$this->endWidget();

$model_beceri_basamaklari = BeceriBasamaklari::model()->findAll("beceri_id=:beceri_id ORDER BY sira",array('beceri_id'=>$model_beceriler->id));
$toplam_basamak_sayisi = count($model_beceri_basamaklari);
$criteria=new CDbCriteria;

$criteria->addCondition("beceri_id=:beceri_id");
$criteria->params = array('beceri_id'=>$model_beceriler->id);

$criteria->order = 'sira';

$basamaklar = new CActiveDataProvider("BeceriBasamaklari", array(
	'criteria'=>$criteria,
	'pagination'=>array(
			'pageSize'=>50,
	),
));
		
$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'ogrenci-grid',
	'dataProvider'=>$basamaklar,
//	'filter'=>$model,
	'summaryText'=>'',
	'selectableRows'=>0,
	'columns'=>array(
		'id',
		Araclar::yaz('basamak_metni','basamak_metni_en'),
		'sira',
		array(
			'class'=>'CButtonColumn',
			'template'=>'{yukari} {asagi} {delete}',
			'headerHtmlOptions'=>array('width'=>'90'),
			'deleteButtonUrl'=>'Yii::app()->createUrl("/yonetici/update", array("id" => '.$model_beceriler->id.',"basamak_id"=>$data->id, "eylem"=>"sil"))',
			'buttons' =>array(
				'yukari' => array(
					'label'=>'Yukarı',     // text label of the button
					'url'=>'Yii::app()->createUrl("/yonetici/update", array("id" => '.$model_beceriler->id.',"basamak_id"=>$data->id, "eylem"=>"yukari"))',       // a PHP expression for generating the URL of the button
					'imageUrl'=>'/images/up16.png',  // image URL of the button. If not set or false, a text link is used
//					'options'=>array('width'=>'16'), // HTML options for the button tag
//					'click'=>'...',     // a JS function to be invoked when the button is clicked
					'visible'=>'$data->sira>1',   // a PHP expression for determining whether the button is visible
				),
				'asagi' => array(
					'label'=>'Aşağı',     // text label of the button
					'url'=>'Yii::app()->createUrl("/yonetici/update", array("id" => '.$model_beceriler->id.',"basamak_id"=>$data->id, "eylem"=>"asagi"))',       // a PHP expression for generating the URL of the button
					'imageUrl'=>'/images/down16.png',  // image URL of the button. If not set or false, a text link is used
//					'options'=>array(...), // HTML options for the button tag
//					'click'=>'...',     // a JS function to be invoked when the button is clicked
					'visible'=>'$data->sira<'.$toplam_basamak_sayisi,   // a PHP expression for determining whether the button is visible
				),
			),
		),
	),
)); 

?>

<?php
echo CHtml::form();
?>
<table>
	<tr>
		<td bgcolor="gray">
			<?php echo Araclar::yaz("Yeni Beceri Basamağı Ekle","Add a new Skill Step"); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Beceri basamağı metni TR","Skill step statement TR"); ?>:
		</td>
	</tr>
	<tr>
		<td>
			<?php 
				echo CHtml::textArea("basamak_metni","",array('cols'=>'60'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Araclar::yaz("Beceri basamağı metni EN","Skill step statement EN"); ?>:
		</td>
	</tr>
	<tr>
		<td>
			<?php 
				echo CHtml::textArea("basamak_metni_en","",array('cols'=>'60'));
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php
				echo CHtml::submitButton('Kaydet');
			?>
		</td>
	</tr>
</table>
<?php
echo CHtml::endForm();
?>